﻿<html>
<!DOCTYPE html>
<html lang="en" class="no-js">

    <head>

        <meta charset="utf-8">
        <title>登录</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">

        <!-- CSS -->
        <link rel="stylesheet" href="../assets/css/reset.css">
        <link rel="stylesheet" href="../assets/css/supersized.css">
        <link rel="stylesheet" href="../assets/css/style.css">

        <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
        <!--[if lt IE 9]>
            <script src="../assets/js/html5.js"></script>
        <![endif]-->

    </head>

    <body>

        <div class="page-container">
            <h1>图书借阅管理系统</h1>
            <br>
            <br>
            <form action="javascript:;" method="post">
                <input type="text" id="username" name="username" class="username" placeholder="请输入您的用户名！">
                <input type="password" id="password" name="password" class="password" placeholder="请输入您的用户密码！">
                <button type="submit" class="submit_button">登录</button>
            </form>
        </div>
		
        <!-- Javascript -->
        <script src="../assets/js/jquery-1.8.2.min.js" ></script>
        <script src="../assets/js/supersized.3.2.7.min.js" ></script>
        <script src="../assets/js/supersized-init.js" ></script>
        <script src="../assets/js/scripts.js" ></script>
        <script type="text/javascript">
            $(function(){
               $(":submit").on("click",function(){
                  $.ajax({
                      url:"login",
                      type:"post",
                      data: JSON.stringify({
                          hm:$("#username").val(),
                          pwd:$("#password").val()
                      }),
                      dataType:"json",
                      success:function(data){
                          if(data.result==2){
                              alert("用户名或密码错误!");
                          }else{
                              window.location.href="/index"
                          }
                      }
                  })
               });
            });
        </script>
    </body>

</html>

